home *** CD-ROM | disk | FTP | other *** search
/ Secrets of Stargate / STARGATE.iso / mac / STARGATE (5MB Macintosh) / STARGATE (5MB Macintosh).DXR / 00006_AW Scripts.ls < prev    next >
Encoding:
Text File  |  1994-10-19  |  4.0 KB  |  143 lines

  1. on leaveWisdomBg
  2.   global gWisdomState
  3.   put EMPTY into line 4 of gWisdomState
  4. end
  5.  
  6. on LinkAWFromLine theLine
  7.   global gWisdomRecs, gWisdomTitleRecs
  8.   set fieldNum to the mouseCast
  9.   if the timer < 20 then
  10.     exit
  11.   end if
  12.   if theLine = -1 then
  13.     resetCursor()
  14.     exit
  15.   end if
  16.   if line theLine of field fieldNum = EMPTY then
  17.     exit
  18.   end if
  19.   spinCursor()
  20.   hilite line theLine of field fieldNum
  21.   wait(10)
  22.   hilite line 999 of field fieldNum
  23.   set curRecord to value(item theLine of gWisdomTitleRecs)
  24.   set theLine to ItemOffset(curRecord, gWisdomRecs)
  25.   put curRecord && theLine
  26.   LinkWisdomFromIcon(theLine)
  27.   startMouse()
  28. end
  29.  
  30. on LoadWisdomCat theCat
  31.   global gResourcePath, gWisdomCategory, gWisdomRecs, gWisdomTitleRecs
  32.   set gWisdomCategory to theCat
  33.   set theLine to LineOffset(gWisdomCategory, field "ANWIS_CN")
  34.   set gWisdomRecs to line value(theLine) of field "ANWIS_CD"
  35.   set gWisdomTitleRecs to line value(theLine) of field "ANWIS_CT"
  36.   LinkTo("W" & value(theLine))
  37. end
  38.  
  39. on LinkBackToWisdomCat
  40.   global gWisdomCategory
  41.   leaveWisdomBg()
  42.   LoadWisdomCat(gWisdomCategory)
  43. end
  44.  
  45. on LinkWisdomFromIcon theSprite, theRecord
  46.   global gWisdomCategory, gWisdomRecs, gWisdomTitleRecs, gIntroBack, gWisdomState, gResourcePath, gOnPC
  47.   spinCursor()
  48.   if not ((theRecord = EMPTY) or voidp(theRecord)) then
  49.     set curRecord to theRecord
  50.     set theSprite to 1
  51.     set numRecs to 1
  52.   else
  53.     set numRecs to the number of items in gWisdomRecs
  54.     set curRecord to value(item theSprite of gWisdomRecs)
  55.   end if
  56.   set theAB to line 4 of gWisdomState
  57.   if not (theAB = 1) then
  58.     set theAB to 1
  59.   else
  60.     set theAB to 0
  61.   end if
  62.   put curRecord & RETURN & theSprite & RETURN & numRecs & RETURN & theAB into line 1 to 4 of gWisdomState
  63.   set sbTxtHdr to field "ANWIS_0"
  64.   set numChunks to line 1 of sbTxtHdr
  65.   delete line 1 of sbTxtHdr
  66.   repeat with z = 1 to the number of lines in sbTxtHdr
  67.     set sRec to word 1 of line z of sbTxtHdr
  68.     set eRec to word 2 of line z of sbTxtHdr
  69.     if (curRecord >= sRec) and (curRecord <= eRec) then
  70.       exit repeat
  71.     end if
  72.   end repeat
  73.   set theLine to curRecord - sRec + 1
  74.   debug("R: " & curRecord)
  75.   set theData to line theLine of field ("ANWIS_" & z)
  76.   spinCursor()
  77.   set the itemDelimiter to "|"
  78.   set theCat to item 3 of theData
  79.   set theTemplate to item 9 of theData
  80.   set theImage to item 10 of theData
  81.   if theTemplate = EMPTY then
  82.     set theTemplate to "H"
  83.   end if
  84.   if theImage = EMPTY then
  85.     set theImage to "STGMENU.PIC"
  86.   end if
  87.   set oldTemplate to line 5 of gWisdomState
  88.   if theTemplate = "V" then
  89.     set theCastName to "AWLNDSC.PIC" & theAB
  90.     set wisFld to "Wisdom Text" & theAB
  91.   else
  92.     set theCastName to "AWPORTR.PIC" & theAB
  93.     set wisFld to "Wisdom Text" & theAB & "V"
  94.   end if
  95.   if gOnPC then
  96.     set the fileName of cast theCastName to gResourcePath & "WISPIC\" & theImage
  97.   else
  98.     set the fileName of cast theCastName to "STARGATE:RESOURCE:WISPIC:" & theImage
  99.   end if
  100.   put putBackChars(item 2 of theData) into field wisFld
  101.   set theLine to LineOffset(gWisdomCategory, field "ANWIS_CN")
  102.   spinCursor()
  103.   set newFrame to "W" & theLine & " BG " & theTemplate & theAB
  104.   if the frame <> label(newFrame) then
  105.     LinkTo(newFrame)
  106.   end if
  107.   set the itemDelimiter to ","
  108.   put theTemplate into line 5 of gWisdomState
  109.   resetCursor()
  110. end
  111.  
  112. on prevWisdom
  113.   global gIntroBack, gWisdomState, gWisdomCategory
  114.   set curItem to value(line 2 of gWisdomState)
  115.   set maxItems to value(line 3 of gWisdomState)
  116.   if curItem = EMPTY then
  117.     set curItem to maxItems
  118.   else
  119.     if curItem = 1 then
  120.       set curItem to maxItems
  121.     else
  122.       set curItem to curItem - 1
  123.     end if
  124.   end if
  125.   LinkWisdomFromIcon(curItem)
  126. end
  127.  
  128. on nextWisdom
  129.   global gIntroBack, gWisdomState, gWisdomCategory
  130.   set curItem to value(line 2 of gWisdomState)
  131.   set maxItems to value(line 3 of gWisdomState)
  132.   if curItem = EMPTY then
  133.     set curItem to 1
  134.   else
  135.     if (curItem > maxItems) or (curItem = maxItems) then
  136.       set curItem to 1
  137.     else
  138.       set curItem to curItem + 1
  139.     end if
  140.   end if
  141.   LinkWisdomFromIcon(curItem)
  142. end
  143.